﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
              用户名：<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="账号不能为空！" ControlToValidate="TextBox1" ForeColor="#FF6600" ValidationGroup="register"></asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="账号不能为admin" ControlToValidate="TextBox1" OnServerValidate="CustomValidator1_ServerValidate" ></asp:CustomValidator>
            <br />
            密码：<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="密码不能为空！" ControlToValidate="TextBox2" ValidationGroup="register" ></asp:RequiredFieldValidator>
            <br />
            确认密码：<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="俩次密码不一致！" ControlToValidate="TextBox3" ControlToCompare="TextBox2" ValidationGroup="register" ></asp:CompareValidator>
            <br />
            年龄：<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="不在年龄范围之内！" MaximumValue="100" MinimumValue="0" ControlToValidate="TextBox4" Type="Double" ValidationGroup="register" ></asp:RangeValidator>
            <br />
            出生日期：<asp:TextBox ID="TextBox5" runat="server" ControlToValidate="TextBox5"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="日期格式不对！" ControlToValidate="TextBox5" ValidationExpression="\d{4}-\d{2}-\d{2}" ValidationGroup="register" ></asp:RegularExpressionValidator>
            <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="日期时间不在范围内！" Type="Date" MinimumValue="1900-01-01" MaximumValue="2021-07-01" ControlToValidate="TextBox5" ValidationGroup="register"></asp:RangeValidator>
            <br />
            毕业时间：<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="日期格式不对！" ControlToValidate="TextBox6" ValidationGroup="register" ValidationExpression="\d{4}-\d{2}-\d{2}"></asp:RegularExpressionValidator>
            <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="日期小于出生日期！" ControlToCompare="TextBox5" ControlToValidate="TextBox6" Type="Date" Operator="GreaterThan" ValidationGroup="register" ></asp:CompareValidator>
            <br />
            邮箱：<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="邮箱格式不对！" ControlToValidate="TextBox7" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"  ValidationGroup="register" ></asp:RegularExpressionValidator>
            <br />
            <asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click" ValidationGroup="register" />
            <br />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" DisplayMode="List" ValidationGroup="register"/>
            <br />
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
        </div>
    </form>
</body>
</html>
